package com.saoft.jcms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.saoft.jcms.entity.Archives;
import com.saoft.jcms.mapper.ArchivesMapper;
import com.saoft.jcms.service.ArchivesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author scc95599
 * @since 2020-02-03
 */
@Service
public class ArchivesServiceImpl extends ServiceImpl<ArchivesMapper, Archives> implements ArchivesService {

    @Autowired
    ArchivesMapper archivesMapper;

    @Override
    public Page<Archives> search(Page page, String search) {
        QueryWrapper<Archives> wrapper = new QueryWrapper<Archives>();
        if (StringUtils.hasLength(search)) {
            wrapper.like("title", "%" + search + "%");
        }
        return archivesMapper.selectPage(page, wrapper);
    }
}
